<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>计算器</title>
</head>
<body>
<form action='/calc/' method='POST'>
    <input type='text' name="x" value="{{ x }}">
    <select name='op'>
        <option
                {% if op == 'add' %}
                    selected
                {% endif %}
                value="add"> +加 </option>
        <option
                {% if op == 'sub' %}
                    selected
                {% endif %}
                value="sub"> -减 </option>
        <option
                {% if op == 'mul' %}
                    selected
                {% endif %}
                value="mul"> *乘 </option>
        <option
                {% if op == 'div' %}
                    selected
                {% endif %}
                value="div"> /除 </option>
    </select>
    <input type='text' name="y" value="{{ y }}"> = <span>{{ result }}</span>
    <div>
        <input type="submit" value='开始计算'>
    </div>
</form>
</body>
</html>